<?php
 
 class __module_md5 {
 	
 	public $urls = array(
 		'default'=>'def',
 		
 		'def' => 'page_default',
 		'createRepo' => 'createRepo' 
 	);
 	
 	public function page_default() {
 		
 		return "MD5 creator";
 		
 	} 
 	
 	static $keys = "", $string = "", $stringCount = 0;
 	
 	public function createRepo() {
 		//self::$keys = "1234567890-=~!@#$%^&*()_+qwertyuiop[]\\asdfghjkl;'zxcvbnm,./йцукенгшщзхъфывапролджэячсмитьбю";
 		self::$keys = "qwertyuiopasdfghjklzxcvbnm1234567890";
 		$startFrom = 4; 	// Начнем со стольки символов
 		$startEnd  = 10; 	// Закончим столькими символами
 		
 		$keysCount = strlen($keys);
 		
 		function createStartString($start, $stop) {
 			$keys = &__module_md5::$keys;
 			
 			$string = "";
 			for($i=0; $i<$stop; $i++) {
 				#if($i<=$start) {
	 			#	$string[$i] = array(
	 		#			'string' => $keys[0],
	 		#			'keyI' => 0
	 		#		);
 				#} else {
 				#	$string[$i] = false;
 				#}
 			}
 			
 			return $string;
 			
 		}
 		
 		function up($i) {
 			$keys = &__module_md5::$keys;
 			$string = &__module_md5::$string;
 			
// 			if(!isset(__module_md5::$string[$i])) exit('DONE!');
 			
 			$key = &$string[$i];
 			if($key['keyI'] < __module_md5::$stringCount-1) {
 				$key['string'] = __module_md5::$keys[($key['keyI']+1)];
 				$key['keyI']++;
 			} else {
 				$key['string'] = __module_md5::$keys[0];
 				$key['keyI']   = 0;
 				up($i+1);
 			}
 		}
 		
 		function getString() {
 			$string = "";
 			foreach(__module_md5::$string as $array)
 				$string .= $array['string'];
 				
 			return $string;
 		}
 		
 		self::$string = createStartString($startFrom, $startEnd);
 		self::$stringCount = strlen(self::$keys);
 		
 		$i=0;
		while(true) {
 			up(0);
 			$i++;
 			if(getString() == "t") exit("Needed generated. {$i}");
		}
 		
 		print_r(self::$string);
 		
 		exit();
 	} 
 	
 }